package com.sxf.auth.login.controller;

import com.sxf.auth.login.service.LoginService;
import com.sxf.auth.login.vo.ForgetPwdReq;
import com.sxf.auth.login.vo.LoginReq;
import com.sxf.auth.login.vo.LoginRes;
import com.sxf.common.param.ResultInfo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @description: TODO
 * @Author Leo
 * @date 2024/3/1620:55
 */
@Api(value = "登陆相关", tags = { "登陆相关" })
@RestController
@Validated
@RequestMapping("/pass")
public class LoginController {

    @Autowired
    LoginService loginService;

    @ApiOperation(value = "登录", produces = "application/json", httpMethod = "POST")
    @PostMapping("/login")
    public ResultInfo<LoginRes> login(@Validated @RequestBody LoginReq req){
        return ResultInfo.success(loginService.login(req));
    }

    @PostMapping("/forgotPwd")
    @ApiOperation(value = "临床协调员忘记密码", produces = "application/json", httpMethod = "POST")
    public ResultInfo<Boolean> register(@RequestBody @Validated ForgetPwdReq req) {
        return ResultInfo.success(loginService.forgetPwd(req));
    }

}
